package model;  

import java.io.Serializable;

import javax.enterprise.inject.Model;

@Model
public class BaseCharacter implements Serializable {  
	private static final long serialVersionUID = 1L;
	
	Attributes baseAttrs;
	Integer lvl;
	Weapon weapon;
	
	public BaseCharacter() {
		super();
		baseAttrs = new BaseAttr();
	}
	
	public void doPhysicalDammageTo(BaseCharacter warrior2) {
		warrior2.reciveDammage(weapon.getPower()*this.getStr());
	}
	private void reciveDammage(Double dammage) {
		this.setHp((double) (this.getHp() + ((this.getDef() - dammage) > 0 ? 0 : (this.getDef() - dammage)))); 
	}
	public Weapon getWeapon() {
		return weapon;
	}
	public void setWeapon(Weapon weapon) {
		this.weapon = weapon;
	}
	public Double getHp() {
		return baseAttrs.getHp();
	}
	public void setHp(Double hp) {
		baseAttrs.setHp(hp);
	}
	public Integer getLvl() {
		return lvl;
	}
	public void setLvl(Integer lvl) {
		this.lvl = lvl;
	}
	public Double getStr() {
		return baseAttrs.getStr();
	}
	public void setStr(Double str) {
		baseAttrs.setStr(str);
	}
	public Double getDef() {
		return baseAttrs.getDef();
	}
	public void setDef(Double def) {
		baseAttrs.setDef(def);
	}
	public void setMaxHp(Double maxHp) {
		baseAttrs.setMaxHp(maxHp);
	}
	public Double getMaxHp(){
		return baseAttrs.getMaxHp();
	}

}  